class MasterSlaveRouter(object):

    # slave，数据读取
    def db_for_read(self,model, **hints):
        return "slave"

    # master，数据写入
    def db_for_write(self,model, **hints):
        return "default"

    def allow_relation(self,obj1, obj2, **hints):
        return True